import Vue from 'vue'
import Router from 'vue-router'

const _import = require('./_import_' + process.env.NODE_ENV)
// in development env not use Lazy Loading,because Lazy Loading too many pages will cause webpack hot update too slow.so only in production use Lazy Loading

/* layout */
import Layout from '../views/layout/Layout'

Vue.use(Router)

/**
 * icon : the icon show in the sidebar
 * hidden : if `hidden:true` will not show in the sidebar
 * redirect : if `redirect:noredirect` will not redirct in the levelbar
 * noDropdown : if `noDropdown:true` will not has submenu in the sidebar
 * meta : `{ role: ['admin'] }`  will control the page role
 **/
export const constantRouterMap = [
  {path: '/404', component: _import('404'), hidden: true},
  {
     path:'/IQC',
     component:_import('IQC/IQC')
  },
  {
    path:'/',
    redirect: '/IQC'
  },
  {
     path:'/Checkout',
     component:_import('Checkout/Checkout')
  },
  {
     path:'/PluginsClear',
     component:_import('PluginsClear/PluginsClear')
  },
  {
     path:'/TuoJiao',
     component:_import('TuoJiao/TuoJiao')
  },
  {
     path:'/XianQie',
     component:_import('XianQie/XianQie')
  },
  {
     path:'/ZhanBanggh',
     component:_import('Zhanbang-GH/ZhanBanggh')
  },
  {
     path:'/ZhanBangzb',
     component:_import('Zhanbang-ZB/ZhanBangzb')
  },
  // {
  //   path: '/',
  //   component: Layout,
  //   redirect: '/dashboard',
  //   children: [{path: 'dashboard', component: _import('dashboard/index')}]

  // },
  // {
  //   path: '/chart/',
  //   component: Layout,
  //   children: [
  //     { path: 'deviceMonit', component: _import('chart/deviceMonit')},
  //     { path: 'deviceRemind', component: _import('chart/deviceRemind')},
  //     { path: 'ledChipOrder', component: _import('chart/ledChipOrder')},
  //     { path: 'output', component: _import('chart/output')}
  //   ]

  // },
  {path: '*', redirect: '/404', hidden: true}
]

export default new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior: () => ({y: 0}),
  routes: constantRouterMap
})
